using System;
using System.Data;
using System.Data.SqlClient;

using EntLibEC.Cmn;
using EntLibEC.Info.Basic;


namespace EntLibEC.Dac.Basic
{
	/// <summary>
	/// Summary description for ProductNotShowTop10Dac.
	/// </summary>
	public class ProductNotShowTop10Dac
	{
		
		public ProductNotShowTop10Dac()
		{
		}

		public int Insert(ProductNotShowTop10Info oParam)
		{
		    string sql = @"insert into Ent_Product_NotShowTop10
                           (
                            ProductSysNo , CreateUserSysNo ,CreateTime
                           )
                           values
                           (
                           @ProductSysNo , @CreateUserSysNo ,@CreateTime
                            )";
			SqlCommand cmd = new SqlCommand(sql);

			SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int,4);
			SqlParameter paramProductSysNo = new SqlParameter("@ProductSysNo", SqlDbType.Int,4);
			SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int,4);
			SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime);

			if(oParam.SysNo != AppConst.IntNull)
				paramSysNo.Value = oParam.SysNo;
			else
				paramSysNo.Value = System.DBNull.Value;

			if(oParam.ProductSysNo != AppConst.IntNull)
				paramProductSysNo.Value = oParam.ProductSysNo;
			else
				paramProductSysNo.Value = System.DBNull.Value;

			if(oParam.CreateUserSysNo != AppConst.IntNull)
				paramCreateUserSysNo.Value = oParam.CreateUserSysNo;
			else
				paramCreateUserSysNo.Value = System.DBNull.Value;

			if(oParam.CreateTime != AppConst.DateTimeNull)
				paramCreateTime.Value = oParam.CreateTime;
			else
				paramCreateTime.Value = System.DBNull.Value;

			cmd.Parameters.Add(paramSysNo);
			cmd.Parameters.Add(paramProductSysNo);
			cmd.Parameters.Add(paramCreateUserSysNo);
			cmd.Parameters.Add(paramCreateTime);

			return SqlHelper.ExecuteNonQuery(cmd);
		}

		public int Delete(int sysno)
		{
		    string sql = "delete from Ent_Product_NotShowTop10 where sysno =" + sysno ;

			SqlCommand cmd = new SqlCommand(sql);

			return SqlHelper.ExecuteNonQuery(cmd);

		}
	}
}
